<template>
  <div id="app">
    <div id="nav">
      <router-link to="/">Home</router-link> |
      <!-- <router-link to="/about">About</router-link> -->
      <router-link :to="{name: 'About'}">About</router-link>
    </div>
    <transition-group name="router">
        <router-view key="one"/>
        <!-- 使用命名视图 -->
        <router-view name="email" key="two"></router-view>
        <router-view name="tel" key="tree"></router-view>
    </transition-group>
  </div>
</template>

<script>
export default {
  data() {
    return {
      trouterTransition: ''
    }
  },
  watch: {
    '$route' (to){
        // to.query && to.query.transitionName && (this.trouterTransition = to.query.transitionName)
    }
  },
}
</script>

<style lang="less">
// 页面进入时-开始的状态
.router-enter{
  opacity: 0;
}
// 页面进入时-页面从没有到有的状态
.router-enter-active{
  transition: opacity 1s ease;
}
// 页面进入时-页面完全显示后的状态
.router-enter-to{
  opacity: 1;
}

// 页面离开时-开始的状态
.router-leave{
  opacity: 1;
}
// 页面离开时-页面从没有到有的状态
.router-leave-active{
  transition: opacity 1s ease;
}
// 页面离开时-页面完全显示后的状态
.router-leave-to{
  opacity: 0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
